<?php
namespace app\admin\controller;

use app\common\lib\Show;
use think\response\Json;

class File extends AdminBase
{
    /**
     * @return Json
     */
    public function uploadFile(): Json
    {
        $file=$this->request->file('file');
        try {
            $result=(new \app\common\business\File())->uploadFile($file);
        }catch (\Exception $e){
            return Show::error([], $e->getMessage(), $e->getCode());
        }
        return Show::success($result);
    }

    public function getFileList(){
        $page=$this->request->get('page');
        $limit=$this->request->get('limit');
        $info=(new \app\common\business\File())->getFileList($page,$limit);
        return Show::success($info);
    }
}
